/* ----------------------------------------------
 * 幻灯片播放器：动态添加图片（正序：先进先显示）
 *
 * 源自 www.leesum.com/blog，leesum收录。
 * Tubz 修改为类实现。
 * 2007.01.22. tubz@21cn.com
 * ==============================================
 */
// 构造函数
function SlidePlayer (width, height, txt_height)
{
    this._width  = width;        // 幻灯片图片宽度
    this._height = height;        // 幻灯片图片高度
    this._htxt = txt_height;    // 幻灯片文字标题高度
    this._tbgc = arguments[3] || "#ffffff";    // 标题背景色
    this._hswf = height + txt_height;

    this._pics = '';
    this._links = '';
    this._texts = '';
}

// 添加图片、标题及链接
SlidePlayer.prototype.add = function (url, img, title)
{
    if (this._pics == '') {
        this._links = url;
        this._pics = img;
        this._texts = title;
    } else {
        this._links = this._links + '|' + url;
        this._pics = this._pics + '|' + img;
        this._texts = this._texts + '|' + title;
    }
}

// 输出 Flash 幻灯片代码
// 请用附带的 swf 文件作为第一个参数
SlidePlayer.prototype.play = function (swf_path)
{
    return '<embed src="' + swf_path + '" wmode="opaque" FlashVars="pics=' + this._pics + '&links=' + this._links + '&texts=' + this._texts + '&borderwidth=' + this._width + '&borderheight=' + this._height + '&textheight=' + this._htxt + '" menu="false" bgcolor="' + this._tbgc + '" quality="high" width="' + this._width + '" height="' + this._hswf + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"/>';
}

